package br.com.unip.persistencia;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;

public class Dao {
	Connection con;
	PreparedStatement pstmt;

	public void abrirBanco() throws Exception {
		Class.forName("org.postgresql.Driver");
		String url = "jdbc:postgresql://localhost:5432/unip";
		String user = "postgres";
		String password = "admin";
		con = DriverManager.getConnection(url, user, password);
	}

	public void fecharBanco() throws Exception {
		if (con != null)
			con.close();
		if (pstmt != null)
			pstmt.close();
	}
}